import os
from datetime import timedelta

# 每页帖子数量
PER_PAGE_COUNT=10

# 项目根路径
BASE_DIR = os.path.dirname(__file__)

# 头像配置
AVATARS_SAVE_PATH = os.path.join(BASE_DIR, "media", "avatars")

# 帖子图片位置
POSTIMG_SAVE_PATH = os.path.join(BASE_DIR, "media", "post")

# session.permanent=True的情况下的过期时间
PERMANENT_SESSION_LIFETIME = timedelta(days=7)


DB_USERNAME = 'root'
DB_PASSWORD = 'root'
DB_HOST = '127.0.0.1'
DB_PORT = '3306'
DB_NAME = 'zlbbs'

DB_URI = 'mysql+pymysql://%s:%s@%s:%s/%s?charset=utf8mb4' % (DB_USERNAME,DB_PASSWORD,DB_HOST,DB_PORT,DB_NAME)
SQLALCHEMY_DATABASE_URI = DB_URI
SQLALCHEMY_TRACK_MODIFICATIONS = False


# MAIL_USE_TLS：端口号587
# MAIL_USE_SSL：端口号465
# QQ邮箱不支持非加密方式发送邮件
# 发送者邮箱的服务器地址
MAIL_SERVER = "smtp.qq.com"
MAIL_PORT = 587
MAIL_USE_TLS = True
# MAIL_USE_SSL = True
MAIL_USERNAME="2504173002@qq.com"
MAIL_PASSWORD="cfzwdhhbaduediee"
MAIL_DEFAULT_SENDER="2504173002@qq.com"

# celery redis 配置
# celery相关的配置
CELERY_BROKER_URL = "redis://:Flask_Redis_Yao@127.0.0.1:6379/0"
CELERY_RESULT_BACKEND = "redis://:Flask_Redis_Yao@127.0.0.1:6379/0"

# Flask-Caching的配置
CACHE_TYPE = "RedisCache"
CACHE_DEFAULT_TIMEOUT = 300
CACHE_REDIS_HOST = "127.0.0.1"
CACHE_REDIS_PORT = 6379
CACHE_REDIS_PASSWORD="Flask_Redis_Yao"

# csrf防止恶意攻击设置
SECRET_KEY="abcdefghijkzoppiuyta"
